How do I measure the execution time of JavaScript code with callbacks